package com.agent.service.impl;

import com.agent.entity.TblCallSerial;
import com.agent.page.EasyuiPage;
import com.agent.repository.TblCallSerialMapper;
import com.agent.service.ITblCallSerialService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("tblCallSerialServiceImpl")
public class TblCallSerialServiceImpl implements ITblCallSerialService {
    @Autowired
    TblCallSerialMapper tblCallSerialMapper;

    @Override
    public int insert(TblCallSerial tblCallSerial) {
        return tblCallSerialMapper.insert(tblCallSerial);
    }

    @Override
    public EasyuiPage list(Integer page, Integer rows,TblCallSerial tblCallSerial) {
        PageHelper.startPage(page, rows,true, true, true);
        List<TblCallSerial> list = tblCallSerialMapper.list(tblCallSerial);
        EasyuiPage<TblCallSerial> pages = new EasyuiPage<TblCallSerial>();
        pages.setRows(list);
        PageInfo<TblCallSerial> pageinfo = new PageInfo<TblCallSerial>(list);
        pages.setTotal(pageinfo.getTotal());
        return pages;
    }

    @Override
    public TblCallSerial findOne(String id) {
        return tblCallSerialMapper.findOne(id);
    }

    @Override
    public int delete(String id) {
        return tblCallSerialMapper.delete(id);
    }

    @Override
    public int update(TblCallSerial tblCallSerial) {
        return tblCallSerialMapper.update(tblCallSerial);
    }
}
